package com.kancy.publicapi.web.runner;

import com.kancy.publicapi.common.util.DebugUtil;
import com.kancy.publicapi.service.CommonService;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.ApplicationArguments;
import org.springframework.boot.ApplicationRunner;
import org.springframework.stereotype.Component;

import java.util.List;

/**
 * @author kancy
 * @date 2019/12/16 10:37
 **/
@Component
@Slf4j
@RequiredArgsConstructor
public class HelloRunner implements ApplicationRunner {
    private final CommonService commonService;
    @Override
    public void run(ApplicationArguments args) throws Exception {
        DebugUtil.startPoint();
        List<String> urls = commonService.listUrls();
        DebugUtil.printPoint("listUrls");
        urls.forEach(url ->{
            log.info("url: {}", url);
        });
        DebugUtil.printPoint("forEach");
        DebugUtil.endPoint();
    }
}
